#ifndef MYAPPLICATION_H
#define MYAPPLICATION_H
#include "ogreapplication.h"
#include "visualisation.h"
#include <OgreErrorDialog.h>
#include <OgreKeyEvent.h>
#include <iostream>
#define ZOOM 100
#define SCALE 25
#define FACTOR 1
#define XCAMERASTART -100
#define YCAMERASTART 200
#define ZCAMERASTART 1000
#define DOUBLECLICKDELAY 500

using namespace Ogre;
using namespace std;

//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
// Interface of MyApplication
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
class MyApplication : public OgreApplication, Ogre::MouseListener
{

private : 
	Ogre::RaySceneQuery* mRaySceneQuery;
    Ogre::Entity*        mSelected;
    Ogre::Overlay*  mPanelOverlay;
    Ogre::String nomFic;
    Ogre::OverlayElement* fileOverlay;
	Ogre::OverlayElement* debugOverlay;
    Ogre::MaterialPtr ligneMaterial;
    Ogre::Timer* mButtonTimer;

	Visualisation* myVisualisation;

	int nbLignes;
	//taille de l'element initial, la taille des autres elements est basée sur celle ci
	Real ratio;
public:
	MyApplication();
	~MyApplication();
	
    virtual void init();
    virtual bool frameStarted(const Ogre::FrameEvent& evt);
    virtual bool frameEnded(const Ogre::FrameEvent& evt);
    virtual void keyPressed(Ogre::KeyEvent* e);
    virtual void keyClicked(Ogre::KeyEvent* e);
    virtual void keyReleased(Ogre::KeyEvent* e);
    void ligne(Ogre::SceneNode* s ,Ogre::Vector3 pos1, Ogre::Vector3 pos2);

	//fonctions de configuration
	void configOverlay();
	void configCamera();
	void configGround();

    virtual void mousePressed(Ogre::MouseEvent*){};
    virtual void mouseReleased(Ogre::MouseEvent*);
    virtual void mouseClicked(Ogre::MouseEvent*){};
    virtual void mouseEntered(Ogre::MouseEvent*){};
    virtual void mouseExited(Ogre::MouseEvent*){};

	//getters
	SceneManager * getSceneManager();
	Ogre::OverlayElement* getFileOverlay();
	Ogre::OverlayElement* getDebugOverlay();
	int getNbLignes();

	//setters
	void setSelected(string nomEntite);
	void setVisualisation(Visualisation * v);
	void setFileOverlay(string s);
	void setDebugOverlay(string s);
	void setNbLignes(int i);
	void setRatio(Real r);
};


#endif
